home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 361_01 / kbqread.c < prev    next >
C/C++ Source or Header  |  1991-09-18  |  667b  |  29 lines

  1.  
  2. /* Kbqread.c ---> A TSR compliant getch() w/ Keys.h Reporting.
  3.  *
  4.  * Author: J.Ekwall                                     13 September 91
  5.  *
  6.  * Copyrighted to the Public Domain.  Unlimited Distribution Authorized.
  7.  *
  8.  * User Assumes All Risks/Liabilities.
  9.  *
  10.  * Last Update: 13 September 91/EK
  11.  */
  12.  
  13. #include <dos.h>
  14.  
  15. int Kbq_read(void)
  16. {
  17.     int c = 0;
  18.     union REGS rg;
  19.  
  20.     do {
  21.        rg.h.ah  = 1; int86(0x16, &rg, &rg);
  22.        if (rg.x.flags & 0x40) { int86(0x28, &rg, &rg); continue; }
  23.        rg.h.ah = 0; int86(0x16, &rg, &rg);
  24.        if (rg.h.al == 0) c = rg.h.ah | 128; else c = rg.h.al;
  25.     } while (c == 0);
  26.     return(c);
  27. }
  28.  
  29.